
import java.io.*;

public class IOdemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        try (OutputStream os = new FileOutputStream("output.txt")) {
            byte[] b = new byte[] {
                    (byte)'G', (byte)'o', (byte)'o', (byte)'d'
            };
            os.write(b);
            // 不要忘记 flush
            os.flush();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
